package com.iis.entity;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;

import com.iis.dao.AgentDAO;
import com.iis.dao.ClientDAO;

public class Client extends Person {
	
	private long idClient;
	private String registrationNo;
	private String category;
	private String region;
	
	public long getIdClient() {
		return idClient;
	}
	public void setIdClient(long idClient) {
		this.idClient = idClient;
	}
	public String getRegistrationNo() {
		return registrationNo;
	}
	public void setRegistrationNo(String registrationNo) {
		this.registrationNo = registrationNo;
	}
	public String getCategory() {
		return category;
	}
	public void setCategory(String category) {
		this.category = category;
	}
	public String getRegion() {
		return region;
	}
	public void setRegion(String region) {
		this.region = region;
	}
	
	public void save(){
		ClientDAO myClientDAO = ClientDAO.getInstances();
		try {
			myClientDAO.save(this);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public static ArrayList<Client> getAll() {
		ClientDAO myClientDAO = ClientDAO.getInstances();
		return myClientDAO.getAll();
	}
	
	public String[] toArray(){
		String[] arr = new String[5];
		arr[0] = String.valueOf(this.getRegistrationNo());
		arr[1] = this.getName();
		arr[2] = this.getCategory();
		return arr;
 	}
}
